// pages/deduction/deduction.js
import {
  request
} from '../../request/index.js'
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    user:{},
    http:'',
    deductionList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let user = typeof wx.getStorageSync('user')==='string'? JSON.parse(wx.getStorageSync('user')):wx.getStorageSync('user');
    console.log(user);
    this.setData({
      user,
      http: app.globalData.http
    });
    request({
      url:'Order/getOrderListByUserId',
      data: {
        user_id:user.user_id
      }
    }).then((result) => {
      console.log(result);
      this.setData({
        deductionList:result.data.data.reverse()
      })
    });
  },
})